#ifndef CHARGINGTCPDRIVE_H
#define CHARGINGTCPDRIVE_H

#include <QObject>
#include <QString>
#include <QTcpSocket>
#include <QTimer>
class ChargingTcpDrive : public QObject {
    Q_OBJECT

public:
    struct {
        bool front;
        bool back;
    } limits;

    enum Operator { UNKNOWN, OPEN, CLOSE, STOP } output{ STOP };

public:
    //    explicit ChargingTcpDrive( QObject* parent = nullptr );
    //    ~ChargingTcpDrive();
    bool open( QTcpSocket& mSocket, const QString& ip, unsigned short port = 50000 );
    void close( QTcpSocket& mSocket );
    bool isConnected( QTcpSocket& mSocket );

    virtual bool setOutput( QTcpSocket& mSocket, Operator oper );
    virtual bool updateInput( QTcpSocket& mSocket );
    virtual bool updateOutput( QTcpSocket& mSocket );

signals:
    void sigSendTips( QString );
    void sigShowTCPData( const QByteArray& tips, const QString& string );
};

#endif  // CHARGINGTCPDRIVE_H
